home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 3565-4.665 / dmg-4385 / issue_10 / 12.pne < prev    next >
Text File  |  1987-04-21  |  5KB  |  182 lines

  1.  
  2.                  WRITING STOS EXTENSIONS - PART 3 of 3
  3.                  =====================================
  4.  
  5.                  By Martin Cubitt for STOSSER disczine
  6.  
  7.  
  8. This is the last part of this mini-series about writing STOS extensions. 
  9. When you have written and tested your interpreter and compiler extensions 
  10. you may consider writing an installation program to make it easier for 
  11. users to install your extension into their STOS work disc. It also looks 
  12. more professional.
  13.  
  14.      I have written a small example of such a program.
  15.  
  16.      My usual header...
  17.  
  18. 10 rem EG extension installer
  19. 20 rem By Martin Cubitt
  20. 30 rem 15th October 1993
  21. 40 rem
  22. 50 rem Last update: 17/10/1993
  23. 60 rem
  24.  
  25.      Work in mode 0 to gain more colours.
  26.  
  27. 100 curs off : palette $0,$0,$0,$0,$0 : mode 0 : key off : hide :
  28.       flash off 
  29.  
  30.      Display options.
  31.  
  32. 110 pen 7
  33. 120 paper 8
  34. 130 centre " EG extension installer "
  35. 140 pen 9
  36. 150 paper 0
  37. 160 locate 0,5
  38. 170 centre "Select from one of the following"
  39. 180 pen 4
  40. 190 paper 6
  41. 200 locate 0,10
  42. 210 centre " 1. Install INTERPRETER extension "
  43. 220 locate 0,12
  44. 230 centre " 2. Install COMPILER extension "
  45. 240 locate 0,15
  46. 250 centre " 9. Exit "
  47. 260 pen 9
  48. 270 paper 0
  49. 280 locate 0,19
  50. 290 centre "Press the number of your choice"
  51. 300 wait vbl 
  52.  
  53.      Set palette once screen writing complete.
  54.  
  55. 310 palette $113,$777,$0,$0,$632,$273,$321,$362,$231,$557,$666,$333
  56. 320 clear key 
  57.  
  58.      Wait for option number to be pressed from one of 3 defined.
  59.  
  60. 330 repeat 
  61. 340  : OPTION=instr("129",inkey$)
  62. 350 until OPTION>0
  63.  
  64.      Jump to line depending on option selected.
  65.  
  66. 360 on OPTION goto 1000,2000,9000
  67.  
  68.      Install interpreter...
  69.  
  70. 998 rem     --------------------------------------------------------
  71. 999 rem   * INSTALL: Interpreter extension *
  72.  
  73.      Sets up file name to save, size of file to be saved, memory bank 
  74. where extension is and the folder for the extension.
  75.  
  76. 1000 FILENAME$="eg.exw"
  77. 1010 FILESIZE=691
  78. 1020 BANK=5
  79. 1030 FOLDNAME$="STOS"
  80. 1040 gosub 3000
  81. 1050 goto 320
  82.  
  83.      Install compiler...
  84.  
  85. 1998 rem    --------------------------------------------------------
  86. 1999 rem  * INSTALL: Compiler extension *
  87. 2000 FILENAME$="eg.ecw"
  88. 2010 FILESIZE=318
  89. 2020 BANK=6
  90. 2030 FOLDNAME$="COMPILER"
  91. 2040 gosub 3000
  92. 2050 goto 320
  93.  
  94.      Actual routine to install...
  95.  
  96. 2998 rem    --------------------------------------------------------
  97. 2999 rem  * INSTALL: An extension *
  98.  
  99.      Ensure file name in upper case.
  100.  
  101. 3000 FILENAME$=upper$(FILENAME$)
  102. 3010 pen 11
  103. 3020 locate 0,23
  104. 3030 centre "Enter EXIT not to install "+FILENAME$
  105. 3040 pen 10
  106. 3050 paper 0
  107. 3060 MSG$="Select "+FOLDNAME$+" folder"
  108.  
  109.      Allow selection of disc and path.
  110.  
  111. 3070 show 
  112. 3080 SELECT$=file select$("*.*",MSG$)
  113. 3090 hide 
  114. 3100 locate 0,23
  115.  
  116.      Clear previous message.
  117.  
  118. 3110 centre space$(len("Enter EXIT not to install "+FILENAME$))
  119.  
  120.      If EXIT entered abort s`install and go back to main menu.
  121.  
  122. 3120 if upper$(SELECT$)="EXIT" then 3160
  123.  
  124.      Catch all errors.
  125.  
  126. 3130 on error goto 3500
  127.  
  128.      Save (install) extension.
  129.  
  130. 3140 bsave FILENAME$,start(BANK) to start(BANK)+FILESIZE
  131. 3150 on error goto 0
  132. 3160 return 
  133.  
  134.      In case of error make loud noise and try again.
  135.  
  136. 3499 rem Error, just return to folder select
  137. 3500 on error goto 0
  138. 3510 resume 3520
  139. 3520 boom 
  140. 3530 goto 3070
  141.  
  142.      End of program, no frills!
  143.  
  144. 8999 rem    --------------------------------------------------------
  145. 9000 default
  146. 9010 end 
  147.  
  148.  
  149. This was a particularly simple example. You may wish to also include a 
  150. manual document with your extension explaining in detail what the commands 
  151. can do. Save this to another bank and treat much like an interpreter or 
  152. compiler extension.
  153.  
  154. You may also wish to add fancy graphics or music. The current install 
  155. program for my EXTRA extension (version 1.87 at time of writing) has a 
  156. serious problem when exiting. It seems to the size of the sample combined 
  157. with what the program does that causes problems. Some versions before 1.87 
  158. had a major problem with the installer in that it would not quite run on a 
  159. half meg machine! I have to admit this is a little crazy when the bells 
  160. and whistles of a program (unnecessary to its functioning) cause it not to 
  161. work. I have reduced the sampled sounds and it now runs on a half meg from 
  162. the AUTO folder.
  163.  
  164. So keep your installer pretty but do not overdo it. More error detection 
  165. could be applied to my example and a check to see of disc memory id free 
  166. and if the file already exists to give a confirmation of the overwrite.
  167.  
  168. I hope that this series has been of some use to you all. Any problems can 
  169. be directed to me but I admit openly that my knowledge of STOS extensions 
  170. is very limited. As I have said many times before, contact Mandarin for 
  171. definite instructions.
  172.  
  173. Good luck, I hope to see extensions cropping up from all areas now. 
  174. Remember, don't mix extensions id's and please do not create an extension 
  175. (such as this) with only a few commands on. It is a waste of an entire 
  176. extension.
  177.  
  178. By the way, I do not expect people to keep this extension on their STOS 
  179. discs so the W id is still free!
  180.  
  181.      Martin.
  182.